import {
  Controller,
  Get,
  Post,
  Body,
  Param,
  Query,
  Inject,
} from '@nestjs/common';
import { GirlService } from './girl.service';
import { BoyService } from '../boy/boy.service';

@Controller('girl')
export class GirlController {
  constructor(
    @Inject('config') private config: any,
    private girlService: GirlService,
    private boyService: BoyService,
  ) {}
  @Post('add')
  addGirl(@Body() body) {
    console.log(body);
    return this.girlService.addGirl();
  }
  @Get('delete/:id')
  delGirl(@Param() param) {
    const id = parseInt(param.id);
    return this.girlService.delGirl(id);
  }
  @Get('update/:id')
  updateGirl(@Param() param) {
    const id = parseInt(param.id);
    return this.girlService.updateGirl(id);
  }
  @Get('list')
  getGirls() {
    return this.girlService.getGirls();
  }
  @Get('getGirlByName')
  getGirlByName(@Query() query) {
    return this.girlService.getGirlByName(query.name);
  }
  @Get('test')
  test() {
    return this.config;
  }
}
